package com.company.nuwa.common.utils;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.Nullable;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>字符串类型</p>
 *
 * @author Lionel Lee
 * @version 1.0: StringTypeUtils.java
 * @date 2020/6/4 9:25
 */
@Slf4j
public class RegexUtils {

    public static boolean simpleMatch(@Nullable String regex, @Nullable String str) {
        if (StringUtils.isBlank(regex) || StringUtils.isBlank(str)) {
            return false;
        }
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(str);
        return matcher.matches();
    }


}